//
//  HomePageRemai01TableViewCell.m
//  GouWoAi
//
//  Created by 赵佟越 on 16/5/7.
//  Copyright © 2016年 zhaotongyue. All rights reserved.
//

#import "HomePageRemai01TableViewCell.h"

@interface HomePageRemai01TableViewCell ()

@property(nonatomic, strong)UIImageView *imageViewLine;

@property(nonatomic, strong)UIImageView *imageViewLine1;

@property(nonatomic, strong)UIImageView *imageViewLine2;
@end

@implementation HomePageRemai01TableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageViewLine = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageViewLine];
        self.imageViewLine1 = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageViewLine1];
        self.imageViewLine2 = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imageViewLine2];
        
        self.imgView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imgView];
        self.bigMoneyLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.bigMoneyLabel];
        self.littleMoneyLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.littleMoneyLabel];
        self.nameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel];
        self.typeLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.typeLabel];
        self.buyNumBtn = [[UIButton alloc]init];
        [self.contentView addSubview:self.buyNumBtn];
        
        
        
        self.imgView1 = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imgView1];
        self.bigMoneyLabel1 = [[UILabel alloc]init];
        [self.contentView addSubview:self.bigMoneyLabel1];
        self.littleMoneyLabel1 = [[UILabel alloc]init];
        [self.contentView addSubview:self.littleMoneyLabel1];
        self.nameLabel1 = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel1];
        self.typeLabel1 = [[UILabel alloc]init];
        [self.contentView addSubview:self.typeLabel1];
        self.buyNumBtn1 = [[UIButton alloc]init];
        [self.contentView addSubview:self.buyNumBtn1];
        
        
        self.imgView2 = [[UIImageView alloc]init];
        [self.contentView addSubview:self.imgView2];
        self.bigMoneyLabel2 = [[UILabel alloc]init];
        [self.contentView addSubview:self.bigMoneyLabel2];
        self.littleMoneyLabel2 = [[UILabel alloc]init];
        [self.contentView addSubview:self.littleMoneyLabel2];
        self.nameLabel2 = [[UILabel alloc]init];
        [self.contentView addSubview:self.nameLabel2];
        self.typeLabel2 = [[UILabel alloc]init];
        [self.contentView addSubview:self.typeLabel2];
        self.buyNumBtn2 = [[UIButton alloc]init];
        [self.contentView addSubview:self.buyNumBtn2];
    }
    return self;
}

- (void)layoutSubviews{
    
    self.imageViewLine.backgroundColor = [UIColor getColorFromRGBString:@"#F2F2F2"];
    [self.contentView addSubview:self.imageViewLine];
    [self.imageViewLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset( ZTY_SCREEN_WIDTH/3);
        make.top.equalTo(self).offset(35);
        make.bottom.equalTo(self).offset(- 35);
        make.width.mas_equalTo(2);
        make.height.mas_equalTo(self.contentView.frame.size.height - 70);
    }];
    
    self.imageViewLine1.backgroundColor = [UIColor getColorFromRGBString:@"#F2F2F2"];
    [self.contentView addSubview:self.imageViewLine1];
    [self.imageViewLine1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.left.mas_equalTo(13);
        make.size.mas_equalTo(CGSizeMake(ZTY_SCREEN_WIDTH - 26, 2));
    }];

    self.imageViewLine2.backgroundColor = [UIColor getColorFromRGBString:@"#F2F2F2"];
    [self.contentView addSubview:self.imageViewLine2];
    [self.imageViewLine2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_left).offset( ZTY_SCREEN_WIDTH/3 * 2);
        make.top.equalTo(self).offset(35);
        make.bottom.equalTo(self).offset(- 35);
        make.width.mas_equalTo(2);
        make.height.mas_equalTo(self.contentView.frame.size.height - 70);
    }];

    
    self.bigMoneyLabel.textColor = [UIColor redColor];
    if (iphone4 || iphone5) {
        self.bigMoneyLabel.font = [UIFont systemFontOfSize:14];
    }else{
        self.bigMoneyLabel.font = [UIFont systemFontOfSize:16];
        [self.bigMoneyLabel sizeToFit];
    }
    self.nameLabel.textColor = [UIColor getColorFromRGBString:@"909090"];
    self.nameLabel.font = [UIFont systemFontOfSize:12];
    
    
    self.typeLabel.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    if (iphone4 || iphone5) {
        self.typeLabel.font = [UIFont systemFontOfSize:9];
    }else{
        self.typeLabel.font = [UIFont systemFontOfSize:11];
    }
    
    
    self.littleMoneyLabel.font = [UIFont systemFontOfSize:11];
    self.littleMoneyLabel.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    //    self.buyNumBtn.backgroundColor = [UIColor grayColor];
    [self.buyNumBtn setImage:[UIImage imageNamed:@"sysicon_n_09@1x"] forState:UIControlStateNormal];
    [self.buyNumBtn addTarget:self action:@selector(buyNumBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imgView.mas_bottom).offset(8);
        make.left.equalTo(self).offset(15);
    }];
    
    [self.typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(7);
        make.left.equalTo(self).offset(15);
    }];
    
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(13);
//        make.centerX.equalTo(self).offset(- ZTY_SCREEN_WIDTH/4);
        make.left.equalTo(self).offset(13);
        make.size.mas_equalTo(CGSizeMake(75, 75));
    }];
    
    [self.bigMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.typeLabel.mas_bottom).offset(7);
        if (iphone4 || iphone5) {
            make.left.equalTo(self).offset(12);
        }else{
            make.left.equalTo(self).offset(15);
        }
        make.size.mas_equalTo(CGSizeMake(ZTY_SCREEN_WIDTH, 16));
    }];
    
    [self.littleMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3);
        make.bottom.equalTo(self.bigMoneyLabel);
        make.size.mas_equalTo(CGSizeMake(65 *_ZTY_SCREEN_WIDTH, 11));
    }];
    
    if (iphone4 || iphone5) {
        [self.buyNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3 -5);
            make.centerY.equalTo(self.bigMoneyLabel);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }else{
        [self.buyNumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3 -10);
            make.centerY.equalTo(self.bigMoneyLabel);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }
    
    self.bigMoneyLabel.textColor = [UIColor redColor];
    if (iphone4 || iphone5) {
        self.bigMoneyLabel.font = [UIFont systemFontOfSize:14];
    }else{
        self.bigMoneyLabel.font = [UIFont systemFontOfSize:16];
        [self.bigMoneyLabel sizeToFit];
    }
    /**
     *  001
     */
    
    self.nameLabel1.textColor = [UIColor getColorFromRGBString:@"909090"];
    self.nameLabel1.font = [UIFont systemFontOfSize:12];
    
    self.bigMoneyLabel1.textColor = [UIColor redColor];
    if (iphone4 || iphone5) {
        self.bigMoneyLabel1.font = [UIFont systemFontOfSize:14];
    }else{
        self.bigMoneyLabel1.font = [UIFont systemFontOfSize:16];
        [self.bigMoneyLabel1 sizeToFit];
    }
    self.typeLabel1.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    if (iphone4 || iphone5) {
        self.typeLabel1.font = [UIFont systemFontOfSize:9];
    }else{
        self.typeLabel1.font = [UIFont systemFontOfSize:11];
    }
    
    
    self.littleMoneyLabel1.font = [UIFont systemFontOfSize:11];
    self.littleMoneyLabel1.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    //    self.buyNumBtn.backgroundColor = [UIColor grayColor];
    [self.buyNumBtn1 setImage:[UIImage imageNamed:@"sysicon_n_09@1x"] forState:UIControlStateNormal];
    [self.buyNumBtn1 addTarget:self action:@selector(buyNumBtn1Action:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.nameLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imgView.mas_bottom).offset(8);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3);
    }];
    
    [self.typeLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(7);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3);
    }];
    
    [self.imgView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(8);
        make.centerX.equalTo(self);
        make.size.mas_equalTo(CGSizeMake(75, 75));
    }];
    
    [self.bigMoneyLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.typeLabel.mas_bottom).offset(7);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3);
        make.size.mas_equalTo(CGSizeMake(ZTY_SCREEN_WIDTH, 16));
    }];
    
    [self.littleMoneyLabel1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3 * 2);
        make.bottom.equalTo(self.bigMoneyLabel);
        make.size.mas_equalTo(CGSizeMake(65 *_ZTY_SCREEN_WIDTH, 11));
    }];
    
    if (iphone4 || iphone5) {
        [self.buyNumBtn1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3 * 2 -5);
            make.centerY.equalTo(self.bigMoneyLabel1);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }else{
        [self.buyNumBtn1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH/3 * 2 -10);
            make.centerY.equalTo(self.bigMoneyLabel1);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }
    

    
    /**
     *  002
     */
    
    self.nameLabel2.textColor = [UIColor getColorFromRGBString:@"909090"];
    self.nameLabel2.font = [UIFont systemFontOfSize:12];
    
    self.bigMoneyLabel2.textColor = [UIColor redColor];
    if (iphone4 || iphone5) {
        self.bigMoneyLabel2.font = [UIFont systemFontOfSize:14];
    }else{
        self.bigMoneyLabel2.font = [UIFont systemFontOfSize:16];
        [self.bigMoneyLabel2 sizeToFit];
    }
    self.typeLabel2.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    if (iphone4 || iphone5) {
        self.typeLabel2.font = [UIFont systemFontOfSize:9];
    }else{
        self.typeLabel2.font = [UIFont systemFontOfSize:11];
    }
    
    
    self.littleMoneyLabel2.font = [UIFont systemFontOfSize:11];
    self.littleMoneyLabel2.textColor = [UIColor getColorFromRGBString:@"909090"];
    
    //    self.buyNumBtn.backgroundColor = [UIColor grayColor];
    [self.buyNumBtn2 setImage:[UIImage imageNamed:@"sysicon_n_09@1x"] forState:UIControlStateNormal];
    [self.buyNumBtn2 addTarget:self action:@selector(buyNumBtn2Action:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.nameLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imgView.mas_bottom).offset(8);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3 * 2);
    }];
    
    [self.typeLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.nameLabel.mas_bottom).offset(7);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3 * 2);
    }];
    
    [self.imgView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self).offset(8);
        make.centerX.equalTo(self).offset(ZTY_SCREEN_WIDTH/3);
        make.size.mas_equalTo(CGSizeMake(75, 75));
    }];
    
    [self.bigMoneyLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.typeLabel.mas_bottom).offset(7);
        make.left.equalTo(self).offset(10 + ZTY_SCREEN_WIDTH/3 * 2);
        make.size.mas_equalTo(CGSizeMake(ZTY_SCREEN_WIDTH, 16));
    }];
    
    [self.littleMoneyLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH);
        make.bottom.equalTo(self.bigMoneyLabel);
        make.size.mas_equalTo(CGSizeMake(65 *_ZTY_SCREEN_WIDTH, 11));
    }];
    
    if (iphone4 || iphone5) {
        [self.buyNumBtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH -5);
            make.centerY.equalTo(self.bigMoneyLabel2);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }else{
        [self.buyNumBtn2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_left).offset(ZTY_SCREEN_WIDTH -10);
            make.centerY.equalTo(self.bigMoneyLabel2);
            make.size.mas_equalTo(CGSizeMake(20, 20));
        }];
    }
    
    
    


    
    // 传入model 后再model中写入
    self.imgView2.image = [UIImage imageNamed:@"user_pic_08"];
    
    self.bigMoneyLabel2.text = @"¥75.0";
    self.typeLabel2.text = @"规格:11kg";
    self.nameLabel2.text = @"新疆吐鲁番葡萄干";
    self.littleMoneyLabel2.text = @"¥30.0";
    
    
    self.imgView.image = [UIImage imageNamed:@"user_pic_06"];
    self.bigMoneyLabel.text = @"¥25.0";
    self.typeLabel.text = @"规格:1kg";
    self.nameLabel.text = @"北美葡萄干";
    self.littleMoneyLabel.text = @"¥30.0";
    
    
    self.imgView1.image = [UIImage imageNamed:@"user_pic_06"];
    self.bigMoneyLabel1.text = @"¥25.0";
    self.typeLabel1.text = @"规格:1kg";
    self.nameLabel1.text = @"北美葡萄干";
    self.littleMoneyLabel1.text = @"¥30.0";
    
}


#pragma mark - ButtonAction
- (void)buyNumBtnAction:(UIButton *)sender{
    // 添加按钮0
}

- (void)buyNumBtn1Action:(UIButton *)sender{
    // 添加按钮1
}

- (void)buyNumBtn2Action:(UIButton *)sender{
    // 添加按钮2
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
